################################################################################
## qDecoder - http://www.qdecoder.org
##
## Copyright (c) 2000-2012 Seungyoung Kim.
## All rights reserved.
##
## Redistribution and use in source and binary forms, with or without
## modification, are permitted provided that the following conditions are met:
##
## 1. Redistributions of source code must retain the above copyright notice,
##    this list of conditions and the following disclaimer.
## 2. Redistributions in binary form must reproduce the above copyright notice,
##    this list of conditions and the following disclaimer in the documentation
##    and/or other materials provided with the distribution.
##
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
## ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
## POSSIBILITY OF SUCH DAMAGE.
################################################################################
## $Id: Makefile.in 648 2012-07-16 21:24:40Z seungyoung.kim $
################################################################################

prefix		= @prefix@
exec_prefix	= @exec_prefix@

## Name
PRGNAME		= qdecoder

## pkgconfig filename
PKGCONFIGNAME   = qdecoder.pc

## Static Library Name
LIBNAME		= lib${PRGNAME}.a

## Shared Library Name
SLIBVERSION	= 12
SLIBNAME	= lib${PRGNAME}.so
SLIBREALNAME	= ${SLIBNAME}.${SLIBVERSION}

## System library directory
LIBDIR		= @libdir@
HEADERDIR	= @includedir@
PKGCONFIGDIR    = ${LIBDIR}/pkgconfig

## Which compiler & options for release
CC		= @CC@
CFLAGS		= @CFLAGS@
CPPFLAGS	= @CPPFLAGS@

## Utilities
AR		= @AR@
ARFLAGS		= -rc
CHMOD		= @CHMOD@
INSTALL		= @INSTALL@
INSTALL_DATA	= @INSTALL_DATA@
LN_S		= @LN_S@
RANLIB		= @RANLIB@
RM		= @RM@
MKDIR		= @MKDIR@
RMDIR		= @RMDIR@

## Objects List
OBJ		= qcgireq.o		\
		  qcgires.o		\
		  qcgisess.o		\
		  qentry.o		\
		  internal.o

## Make Library
all: qdecoder

qdecoder: ${OBJ}
	${AR} ${ARFLAGS} ${LIBNAME} ${OBJ}
	${RANLIB} ${LIBNAME}
	${CC} -shared -Wl,-soname,${SLIBREALNAME} -o ${SLIBREALNAME} ${OBJ}
	${LN_S} -f ${SLIBREALNAME} ${SLIBNAME}

install: all
	${MKDIR} -p ${DESTDIR}${HEADERDIR}
	${MKDIR} -p ${DESTDIR}${LIBDIR}
	${MKDIR} -p ${DESTDIR}${PKGCONFIGDIR}
	${INSTALL_DATA} qdecoder.h ${DESTDIR}${HEADERDIR}/qdecoder.h
	${INSTALL_DATA} ${LIBNAME} ${DESTDIR}${LIBDIR}/${LIBNAME}
	${INSTALL_DATA} ${SLIBREALNAME} ${DESTDIR}${LIBDIR}/${SLIBREALNAME}
	${INSTALL_DATA} ${PKGCONFIGNAME} ${DESTDIR}${PKGCONFIGDIR}/${PKGCONFIGNAME}
	( cd ${DESTDIR}${LIBDIR}; ${LN_S} -f ${SLIBREALNAME} ${SLIBNAME} )

deinstall: uninstall
uninstall:
	${RM} -f ${HEADERDIR}/qdecoder.h
	${RM} -f ${LIBDIR}/${LIBNAME}
	${RM} -f ${LIBDIR}/${SLIBREALNAME}
	${RM} -f ${LIBDIR}/${SLIBNAME}
	${RM} -f ${PKGCONFIGDIR}/${PKGCONFIGNAME}
	${RMDIR} -p --ignore-fail-on-non-empty ${HEADERDIR}
	${RMDIR} -p --ignore-fail-on-non-empty ${PKGCONFIGDIR}
	${RMDIR} -p --ignore-fail-on-non-empty ${LIBDIR}

doc:
	doxygen doxygen.conf

cleandoc:
	${RM} -rf ../doc/html

clean:
	${RM} -f ${OBJ} ${LIBNAME} ${SLIBREALNAME} ${SLIBNAME}

## Compile
.c.o:
	${CC} ${CFLAGS} ${CPPFLAGS} -c -o $@ $<
